ssl.c: Move code out and some fixes#10926
Conversation
27ab328 to
49f9adb
Compare
|
wolfSSL-Fenrir-bot
left a comment
There was a problem hiding this comment.
Fenrir Automated Review — PR #10926
Scan targets checked: wolfcrypt-rs-bugs, wolfssl-bugs, wolfssl-src
Findings: 3
3 finding(s) posted as inline comments (see file-level comments below)
This review was generated automatically by Fenrir. Findings are non-blocking.
49f9adb to
0b2e533
Compare
wolfSSL-Fenrir-bot
left a comment
There was a problem hiding this comment.
Fenrir Automated Review — PR #10926
Scan targets checked: wolfcrypt-rs-bugs, wolfssl-bugs, wolfssl-src
No new issues found in the changed files. ✅
|
Jenkins: retest this please FIPS-ready FAILED |
0b2e533 to
a3babcf
Compare
a3babcf to
ad179bc
Compare
|
Jenkins: retest this please FIPS-ready FAILED |
ssl_api_hs.c: Handhshake code ssl_api_rw.c: Reading and writing ssl_err.c: wolfSSL_ERR API ssl_asn1.c: Moved wolfSSL_OBJ API in. Move nid2oid/oid2nid in. ssl_crypt.c: Moved in wolfSSL_RAND API. ssl_api_cert.c, ssl_api_pk.c, ssl_api_dtls.c, ssl_api_crl_osp.c: Added more functions that were clearly in those areas. Fixed nid2oid/oid2nid to use wolfssl_object_info[]. wolfssl_object_info has calculated start and ends of groups for faster lookup. Re-ordered the list within groups for faster lookup. Removed duplicate OID row - WC_NID_userId, WC_NID_userId. Added entries that were only in nid2oidi/oid2nid: - ED25510, Ed448, CSR entries AddSession was declared before HAVE_GLOBAL_RNG was defined - moved global RNG code.
ad179bc to
961ae19
Compare
There was a problem hiding this comment.
Pull request overview
This PR refactors the monolithic ssl.c by moving OpenSSL-compat and API surface areas into dedicated compilation units, while also improving OID/NID lookup performance via a reorganized wolfssl_object_info[] table and a precomputed “group slice” index initialized at wolfSSL_Init().
Changes:
- Split handshake and I/O APIs into
ssl_api_hs.candssl_api_rw.c, and moved OpenSSL ERR APIs intossl_err.c. - Moved/expanded OpenSSL RAND compatibility into
ssl_crypto.cand expanded certificate/OCSP/DTLS-related APIs into their respectivessl_api_*.cfiles. - Reworked OID/NID mapping by centralizing entries in
wolfssl_object_info[]and adding a computed group-range index (wolfssl_object_info_slice_init()).
Reviewed changes
Copilot reviewed 11 out of 12 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
wolfssl/internal.h |
Declares wolfssl_object_info_slice_init() for init-time setup. |
src/ssl_err.c |
Adds OpenSSL ERR-API implementation split out from ssl.c. |
src/ssl_crypto.c |
Adds/moves OpenSSL RAND API compatibility implementation. |
src/ssl_asn1.c |
Adds the consolidated wolfssl_object_info[] table and faster group-scoped OID/NID lookup helpers. |
src/ssl_api_rw.c |
Adds/moves read/write/shutdown/data-path APIs into a dedicated unit. |
src/ssl_api_pk.c |
Adds SRP/OpenSSL-compat key-related APIs into the PK unit. |
src/ssl_api_hs.c |
Adds/moves handshake/connect/accept and related OpenSSL-compat handshake helpers. |
src/ssl_api_dtls.c |
Adds DTLS APIs, including stateless accept flow and callback handling. |
src/ssl_api_crl_ocsp.c |
Adds OpenSSL OCSP URL parsing helper for responder URLs. |
src/ssl_api_cert.c |
Adds certificate callback plumbing and peer/verified chain construction helpers. |
src/include.am |
Ensures the newly split source files are included in distribution. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Description
ssl_api_hs.c: Handhshake code
ssl_api_rw.c: Reading and writing
ssl_err.c: wolfSSL_ERR API
ssl_asn1.c: Moved wolfSSL_OBJ API in. Move nid2oid/oid2nid in. ssl_crypt.c: Moved in wolfSSL_RAND API.
ssl_api_cert.c, ssl_api_pk.c, ssl_api_dtls.c, ssl_api_crl_osp.c:
Added more functions that were clearly in those areas.
Fixed nid2oid/oid2nid to use wolfssl_object_info[]. wolfssl_object_info has calculated start and ends of groups for faster lookup. Re-ordered the list within groups for faster lookup. Removed duplicate OID row - WC_NID_userId, WC_NID_userId. Added entries that were only in nid2oidi/oid2nid:
AddSession was declared before HAVE_GLOBAL_RNG was defined - moved global RNG code.
Testing
Regression tested OpenSSL API